<template>
  <page-header-wrapper :title="false">
    <a-card title="订单详情">
      <a-spin :spinning="loading">
        <a-descriptions bordered>
          <a-descriptions-item label="商标名称">
            {{intentDetail.tm_name}}
          </a-descriptions-item>
          <a-descriptions-item label="商标类别">
            <div v-for="(item, index) in categoryOpts" :key="index">
              <div v-if="intentDetail.category == index">{{item}}</div>
            </div>
          </a-descriptions-item>
          <a-descriptions-item label="提交顾问">
            {{intentDetail.username}}
          </a-descriptions-item>
          <a-descriptions-item label="提交时间">
            {{intentDetail.created_at}}
          </a-descriptions-item>
          <a-descriptions-item label="国家">
            <div v-for="(item, index) in regionOpts" :key="index">
              <div v-if="intentDetail.region == index">{{item}}</div>
            </div>
          </a-descriptions-item>
          <a-descriptions-item label="客户姓名">
            {{intentDetail.applicant_name}}
          </a-descriptions-item>
          <a-descriptions-item label="客户联系电话">
            {{intentDetail.applicant_phone}}
          </a-descriptions-item>
          <a-descriptions-item label="客户预算">
            {{intentDetail.budget}}
          </a-descriptions-item>
          <a-descriptions-item label="售价">
            {{intentDetail.foreign_price}}
          </a-descriptions-item>
          <a-descriptions-item label="官费">
            {{intentDetail.inward_official_fee}}
          </a-descriptions-item>
          <a-descriptions-item label="备注">
            {{intentDetail.remake}}
          </a-descriptions-item>
        </a-descriptions>
      </a-spin>
    </a-card>
  </page-header-wrapper>
</template>

<script>
  import { getIntentView } from '@/api/transaction'
  export default {
    name: 'IntentDetail',
    data () {
      return {
        intentDetail: {},
        categoryOpts: {},
        regionOpts: {},
        loading: false
      }
    },
    activated () {
      this.getDetail(this.$route.params.id)
    },
    methods: {
      getDetail (id) {
        const app = this
        app.loading = true
        getIntentView(id).then(res => {
          if (res.status === 0) {
            app.intentDetail = res.result.intent
            app.categoryOpts = res.result.category_opts
            app.regionOpts = res.result.region_opts
          }
        }).finally(() => {
          app.loading = false
        })
      }
    }
  }
</script>

<style scoped>

</style>
